.\"
.\"  
.\" Copyright (c) 1988 by Hewlett-Packard Company
.\" 
.\" Permission to use, copy, modify, and distribute this software 
.\" and its documentation for any purpose and without fee is hereby 
.\" granted, provided that the above copyright notice appear in all 
.\" copies and that both that copyright notice and this permission 
.\" notice appear in supporting documentation, and that the name of 
.\" Hewlett-Packard not be used in advertising or publicity pertaining 
.\" to distribution of the software without specific, written prior 
.\" permission.
.\"
.\" Add simple keeps to MAN macros so .TS/.TE will work
.\"
.de KS	\"	Keep start
.br
.in 0
.di KP
..
.de KE	\" 	Keep end
.br
.di
.ne \\n(dnu
.nr fI \\n(.u
.nf
.KP
.if \\n(fI .fi
.in
..
.TH XmGraph 3X "" "" "" ""
.na
.na
.SH NAME
XmGraphWidgetClass - the OSF/Motif-compatible graph widget.
.SH SYNOPSIS
\fB
.B #include <Xm/Xm.h>
.br
.B #include "Graph.h"
.sp
.SH DESCRIPTION
The XmGraph widget provides the application developer with the ability to
display any group of widgets as a graph, with each widget representing a
node. The graph can be disconnected, as well as contain cycles.  The arcs
used to connect the nodes are instances of an XmArc widget, developed
specifically for use with the XmGraph widget. Arc may be undirected,
directed or bidirected. Note that the XmGraph widget does not understand
the semantics of arc direction, ie. for layout and editing purposes, an arc
will always have a parent and a child regardless of its direction.  The
XmGraph widget has the ability to arrange all nodes either horizontally or
vertically according to an internal layout algorithm, and supports an edit
mode in which arcs and nodes may be interactively repositioned as well as
created, and a read-only mode in which all events are passed directly to
the children of the Graph widget. In edit mode, the XmGraph takes over all
device events for editing commands.
.SS CLASSES
.P
The XmGraph widget inherits behavior and resources from the Core,
Composite, Constraint and XmManager classes.
.sp
The class pointer is \fBxmGraphWidgetClass\fP
.sp
The class name is \fBXmGraph\fP. 
.P
.SS "NEW RESOURCES"
.P
The Graph widget defines a set of resource types used by the programmer to
specify the data for the graph.  The programmer can also set the values for
the Core, Composite, and Constraint widget classes to set attributes for
this widget. The following table contains the set of resources defined by
Graph. To reference a resource by name or by class in a .Xdefaults file,
remove the \fBXmN\fP or \fBXmC\fP prefix and use the remaining letters.  To
specify one of the defined values for a resource in a .Xdefaults file,
remove the \fBXm\fP prefix and use the remaining letters (in either lower
case or upper case, but include any underscores between words).  The codes
in the access column indicate if the given resource can be set at creation
time (\fBC\fP), set by using \fBXtSetValues\fP (\fBS\fP), retrieved by
using \fBXtGetValues\fP (\fBG\fP), or is not applicable (\fBN/A\fP).
.DS
.TS
center allbox;
cBp9 ssss
lBp8 lBp8 lBp8 lBp8 lBp8
lp8lp8lp8lp8lp8.
XmGraph Resource Set
Name	Class	Type	Default	Access
_
XmNeditable	XmCEditable	Boolean	False	CSG
XmNallowMultipleSelections	XmCAllowMultipleSelections	Boolean	True	CSG
XmNautoLayoutMode	XmCAutoLayoutMode	XmRAutoLayoutType	XmNEVER	CSG
XmNarcDrawMode	XmCArcDrawMode	String	XmPOSITION_RELATIVE	CSG
XmNdoubleClickInterval	XmCDoubleClickInterval	XmRInt	250	CSG
XmNdefaultNodeClass	XmCDefaultNodeClass	XmRInt	xmPushButtonGadgetClass	CSG
XmNinteractiveArcDirection	XmCInteractiveArcDirection	unsigned char	XmUNDIRECTED	CSG
XmNmovableNodes	XmCMovableNodes	XmRBoolean	TRUE	CSG
XmNtwinsVisible	XmCTwinsVisible	Boolean	True	CSG
XmNreorient	XmCReorient	Boolean	False	CSG
XmNreLayout	XmCReLayout	Boolean	False	CSG
XmNorientation	XmCOrientation	XmROrientation	XmHORIZONTAL	CSG
XmNchildSpacing	XmCChildSpacing	short	40	CSG
XmNsiblingSpacing	XmCSiblingSpacing	short	30	CSG
XmNnewArcCallback	XmCCallback	Pointer	NULL	C
XmNnewNodeCallback	XmCCallback	Pointer	NULL	C
XmNnodeMovedCallback	XmCCallback	Pointer	NULL	C
XmNarcMovedCallback	XmCCallback	Pointer	NULL	C
XmNdefaultActionCallback	XmCCallback	Pointer	NULL	C
XmNselectNodeCallback	XmCCallback	Pointer	NULL	C
XmNselectArcCallback	XmCCallback	Pointer	NULL	C
XmNdeselectCallback	XmCCallback	Pointer	NULL	C
XmNselectSubgraphCallback	XmCCallback	Pointer	NULL	C
.TE
.KE
.sp 1
.IP "\fBXmNeditable\fP"
When this resource is TRUE, the Graph widget is in edit mode. The user can
interactively reposition individual and multiple nodes and arcs, add new
nodes and arcs, and change the connections of arcs to nodes.  (See
Translations)
.IP "\fBXmNallowMultipleSelections\fP"
When this resource is TRUE, (the default), multiple nodes and arcs can be
selected, either by sweeping out a region on the screen with the mouse, or
by holding down the SHIFT key in conjunction with mouse Button1, or by
selecting a subtree using <Ctrl> Button1. If this resource is FALSE, all
these operations are disabled.
.IP "\fBXmNtwinsVisible\fP"
When this resource is FALSE (the default), arcs that extend between the
same 2 nodes will be drawn on top of the other, in arbitrary order. When
this resource is TRUE, 1 arc is drawn as a straight line and the rest are
drawn as non-overlapping curves between the same 2 points.
.IP "\fBXmNarcDrawMode\fP"
The value of this resource determines how all arcs in the graph are drawn.
If XmNarcDrawMode is XmPOSITION_RELATIVE (the default), arcs are drawn from
the center of the parent node to the center of the child node (without
actually overlapping the node widgets). If XmNarcDrawMode is
XmPOSITION_FIXED, the arcs will be drawn from the middle bottom of the
parent to the middle top of the child if XmNorientation is XmVERTICAL, and
from the middle right of the parent to the middle left of the child if
XmNorientation is XmHORIZONTAL.
.IP "\fBXmNorientation\fP"
If this resource is XmHORIZONTAL the graph horizontal (left to right)
layout algorithm is invoked on the graph widget, otherwise if its value is
XmVERTICAL the graph vertical (top to bottom) layout algorithm is invoke
Also, see under XmNarcDrawMode for the effect of this resource on how arcs
are drawn.
.IP "\fBXmNreorient\fP"
Any time this resource is set to TRUE, regardless of its current value, the
graph widget is re-laid out vertically if its direction is currently
XmHORIZONTAL, or horizontally otherwise.
.IP "\fBXmNreLayout\fP"
Any time this resource is set to TRUE, regardless of its current value, the
graph widget is re-laid out in the current direction.
.IP "\fBXmNchildSpacing and XmNsiblingSpacing\fP"
These 2 resources determine the space the layout algorithm will leave
between parent and child (childSpacing) and between children of the same
node (siblingSpacing). The value of these resources is interpreted in terms
of the current value of the XmNunitType resource.
.IP "\fBXmNautoLayoutMode\fP"
This resource control if and when the graph is relayed out as new arcs and
nodes are added. This resource can take on the values XmNEVER, XmALWAYS,
XmARCS_ONLY, XmNODES_ONLY, or XmPARTIAL, which behave in the following
ways:
.in +2
.br
\fBXmNEVER\fP: When XmNautoLayoutMode is XmNEVER, the graph widget never
automatically lays out the graph. A new layout of the entire graph can be
triggered by calling XmGraphLayout() or an relayout of a subpart of the
graph can be triggered by calling XmRelaySubGraph(). A complete relayout
can also be triggered by setting the XmNrelayout resource to TRUE.
.br
\fBXmALWAYS\fP: When XmNautoLayoutMode is XmALWAYS, the graph widget
triggers a relayout whenever a new node or arc is managed, or when a arc is
moved from one node to another. This happens regardless of whether or not
the change is made interactively or programatically.
.br
\fBXmARCS_ONLY\fP: When XmNautoLayoutMode is XmARCS_ONLY, the graph widget
triggers a complete relayout whenever an arc is added
or moved.
.br
\fBXmNODES_ONLY\fP: When XmNautoLayoutMode is XmNEVER, the graph widget
triggers a complete relayout whenever a node is \fIinteractively\fP added.
.br
\fBXmPARTIAL\fP: When XmNautoLayoutMode is XmNEVER, the graph widget
triggers a partial relayout whenever an arc is added or moved. The relayout
is performed by calling XmRelaySubgraph, using the value of the arc's
XmNfrom resource as the root of a subgraph.
.in -2
.br
It is expected that none of these approaches will perform optimally
according to the users expectations, but may be useful in some cases.
.IP "\fBXmNdefaultNodeClass\fP"
When XmNeditable is TRUE, the user can add new nodes interactively to the
graph. The value of this resource determines what type of widget is created
and must be a class pointer to a valid widget class.  The default is an
XmPushButtonGadget.
.IP "\fBXmNselectSubgraphCallback, XmNselectArcCallback and XmNselectNodeCallback\fP"
These callback lists are invoked when an arc, subgraph or node is selected.
The argument list to the callbacks includes the widget of the subgraph
root, the arc widget, and the node widget respectively. The reasons are
XmCR_SELECT_SUBGRAPH, XmCR_SELECT_ARC, and XmCR_SELECT_NODE, respectively.
.IP "\fBXmNarcMovedCallback and XmNnodeMovedCallback\fP"
These callback lists are invoked when an arc or node is moved interactively
by the user. When a node is being moved, the node is first positioned
according to the user's instructions and then the application's callback is
called. When an arc is moved, the callback is invoked before the arc is
moved to give the programmer the opportunity to disallow the move (See
Callbacks). The argument list to the callbacks includes the the arc widget,
and the node widget respectively.  The reason member of the callback struct
is XmCR_ARC_MOVED or XmCR_NODE_MOVED, respectively.
.IP "\fBXmNnewArcCallback and XmNnewNodeCallback\fP"
This callback list is invoked when a new arc or node is created
interactively by the user. The arc or node is automatically created by the
system and positioned according to the users instructions. In the case of a
node, the default node is a XmPushButtonGadget.  The applications's
XmNnewNodeCallback or XmNnewArcCallback is called before the arc or node is
managed, with the node or arc as the widget member of the call data struct,
alloing the application to create or set whatever information the arc or
node represents and to modify the widgets resources. The reason member of
the call data structure is XmCR_NEW_ARC or XmCR_NEW_NODE, respectively.
.SS "Inherited Resources"
XmGraph inherits behavior and resources from the following superclasses.
For a complete description of these resources, refer to the man page for
that superclass.
.DS
.TS
center allbox;
cBp9 ssss
lBp8 lBp8 lBp8 lBp8 lBp8
lp8lp8lp8lp8lp8.
XmManager Resource Set
Name	Class	Type	Default	Access
_
XmNforeground	XmCForeground	Pixel	dynamic	CSG
XmNhelpCallback	XmCCallback	XtCallbackList	NULL	C
XmNunitType	XmCUnitType	unsigned char	XmPIXELS	CSG
XmNuserData	XmCUserData	caddr_t NULL	CSG
.TE
.DE
.sp 1
.DS
.TS
center allbox;
cBp9 ssss
cBp8 cBp8 cBp8 cBp8 cBp8
lp8lp8lp8lp8lp8.
Core Resource Set
Name	Class	Type	Default	Access
_
XmNaccelerators	XmCAccelerators	XtTranslations	NULL	CSG
XmNancestorSensitive	XmCSensitive	Boolean	True	G
XmNbackground	XmCBackground	Pixel	dynamic	CSG
XmNbackgroundPixmap	XmCPixmap	Pixmap	XmUNSPECIFIED_PIXMAP	CSG
XmNborderColor	XmCBorderColor	Pixel	Black	CSG
XmNborderPixmap	XmCPixmap	Pixmap	XmUNSPECIFIED_PIXMAP	CSG
XmNborderWidth	XmCBorderWidth	Dimension	0	CSG
XmNcolormap	XmCColormap	Colormap	XtCopyFromParent	CG
XmNdepth	XmCDepth	int	XtCopyFromParent	CG
XmNdestroyCallback	XmCCallback	XtCallbackList	NULL	C
XmNheight	XmCHeight	Dimension	0	CSG
XmNmappedWhenManaged	XmCMappedWhenManaged	Boolean	True	CSG
XmNscreen	XmCScreen	Pointer	XtCopyScreen	CG
XmNsensitive	XmCSensitive	Boolean	True	CSG
XmNtranslations	XmCTranslations	XtTranslations	NULL	CSG
XmNarcWidth	XmCArcWidth	Int	0	CSG
XmNx	XmCPosition	Position	0	CSG
XmNy	XmCPosition	Position	0	CSG
.TE
.DE
.DE
.sp 1
.SS "Callback Information"
The following structure is returned with each callback.
.sp 1
.nf
.ta .25i 1.1i
\fBtypedef struct\fP {
    \fBint\fP          \fIreason\fP;
    \fBXEvent\fP       \fI*event\fP;
    \fBBoolean\fP      \fIinteractive;\fP
    \fBWidgetList\fP   \fIselected_widgets;\fP
    \fB int\fP         \fInum_selected_widgets\fP;
    \fBWidgetList\fP   \fIselected_arcs\fP;
    \fBint\fP          \fInum_selected_arcs\fP
    \fBWidget\fP       \fIwidget\fP;
    \fBWidget\fP       \fIold_to, old_from, new_to, new_from\fP;
    \fBBoolean\fP      \fIdoit\fP;
} \fBXmGraphCallbackStruct\fP;
.fi
.sp 1
.IP "\fIreason\fP" .75i
Indicates why the callback was invoked. Possible reasons are:
.sp
XmCR_NEW_ARC: A new arc has been created.
.br
XmCR_NEW_NODE: A new arc has been created.
.br
XmCR_NODE_MOVED: One or more nodes has been moved.
.br
XmCR_ARC_MOVED: An arc has been moved. This implies the arc has changed the
nodes it points to, not a physical change in the location of the arcs. This
would be indicated by a XmNnodeMovedCallback.
.br
XmCR_SELECT_NODE: A node has been selected
.br
XmCR_SELECT_ARC: An arc has been selected
.br
XmCR_SELECT_SUBGRAPH: A subgraph has been selected.
.br
XmCR_NODE_DOUBLE_CLICK: A double click on a node
.br
XmCR_ARC_DOUBLE_CLICK: A double click on an Arc widget.
.br
XmCR_DOUBLE_CLICK:  A double click not over a node or arc has occurred.
.br
XmCR_DESELECT:      One or more arcs or nodes has been deselected.
.IP "\fIevent\fP" .75i
Points to the \fBXEvent\fP that triggered the callback.
.IP "\fIwidget\fP" .75i
Indicates the current arc or node widget associated with this callback.
.IP "\fIinteractive\fP" .75i
TRUE if the callback was invoked as a result of a user action. In the
current Graph, this is always TRUE. This field will probably dissapear
soon.
.IP "\fIselected_widgets\fP" .75i
If this member is not NULL, multiple node widgets are currently selected.
This is then an array containing num_selected_widgets.  Note that if one
widget is selected, one widget will be one this list.  This list belongs
the the Graph and MUST be
treated as READ-ONLY.
.IP "\fInum_selected_widgets\fP" .75i
The number of selected node widgets.
.IP "\fIselected_arcs\fP" .75i
If this member is not NULL, one or more widgets are currently selected.
This is then an array containing num_selected_arcs. Note that if one arc is
selected, one arc will be one this list. This list belongs the the Graph
and MUST be treated as READ-ONLY.
.IP "\fInum_selected_arcs\fP" .75i
The number of selected arc widgets.
.IP "\fIold_to, old_from, new_to, new_from\fP" .75i
If an arc has been moved, the nodes the arc formerly connected, and the
nodes the arc will now connect. Only valid for XmNarcEditedCallback and
XmNarcMovedCallback.
.IP "\fIdoit\fP" .75i
This member is initialized to TRUE. If the application wishes to abort or
disallow certain operations, this field can be set to FALSE before the
callback returns. An example of how this might be used is if the
application wishes to create a different type of node widget than the
default. If this member is set to FALSE in an XmNnewNodeCallback, the Graph
widget will destroy the node widget it has created. The application can
them create a new node at the position of the interactively created widget.
Only used with XmNarcEditedCallback, XmNarcMovedCallback,
XmNnewNodeCallback, and XmNnewArcCallback lists.
.sp 1
.IP "\fBLayout Algorithm\fP"
The current Graph layout algorithm is a simple and efficient tree layout
algorithm adapted to handle forests of nodes. It works as follows: It first
compiles a list of "roots" by looking for, in order,: (1) a unique node of
each subgraph selected by the user via the \fIXmGraphInsertRoots\fP function,
(2) any node without a parent, (3) of those \fBstrongly connected\fP
components of the graph (a strongly connected component is a subgraph in
which any node can reach all other nodes) which cannot be reached by a root
chosen previously, a node is chosen at random.  The algorithm then
traverses the subgraphs rooted at each node in the "roots" list, converting
each in turn into a tree. If a node belongs to more than one of these
subgraphs it will be placed in the tree where its deepest parent belongs.
The algorithm then performs the actual layout, and finally reconverts the
subtrees back to the original graph.  The nodes in the "roots" list will be
laid out, at the same level, as the topmost (vertical layout) or rightmost
(horizontal layout) widgets in their respective subgraph, while the rest of
the nodes will be placed under (to the right of) them. If any of the
subgraphs have cycles the layout algorithm will arbitrarily "break" them
for layout purposes only.
.sp 2
.SS "Behavior"
XmGraph behavior is summarized below.
.IP
None <Btn1Down>:         Indicate()
.br
Shift <Btn1Down>:        AddIndicate()
.br
Ctrl <Btn1Down>:         IndicateSubtree()
.br
Ctrl<Btn2Down>:          StartAddNode()
.br
<Btn2Down>:              SelectForMotion()
.br
<Btn1Up>:                EndButtonAction()
.br
<BtnMotion>:             HandleMotion()
.br
<EnterWindow>:	         Enter()
.br
<FocusIn>:	         FocusIn()
.br
<FocusOut>:	         FocusOut()
.br
<Key>F1:	         Help()
.sp
.SH "ACTIONS"
.sp 1
\fBIndicate:\fP If in edit mode, and the mouse is on a node widget or over
an arc, it highlights that node or arc and begins a selection process. If
the mouse is not over a node it also begins a rubberbanding selection
process. See HandleMotion() and EndButtonAction().
.sp 1
\fBAddIndicate:\fP If in edit mode, and the mouse is on a node widget or
over an arc, it highlights that node or arc and begins a selection process
without deselecting already selected arcs or nodes. See HandleMotion() and
EndButtonAction().
.sp 1
\fBIndicateSubtree:\fP If in edit mode, and the mouse is on a node widget,
it highlights the subtree whose root is that node and begins a selection
process.  See HandleMotion() and EndButtonAction().
.sp 1
\fBStartAddArcOrNode:\fP If in edit mode, and the sprite is not over any
existing node, displays a rubberband box to prompt the user to position a
new node widget. If over a node, prompts the user with a rubber band line
to position the other end of a new arc.
.sp 1
\fBHandleMotion():\fP Handles all mouse motion depending on a state
variable set by the button down action. Conceptually, this action can be
one of:
.br
.in +2
\fBCancel()\fP: If in edit mode, moving out of the indicated widget
unhighlights the indicated widget. However, moving back into the widget
without releasing the mouse button, re-highlights the indicated widget.
Thus a selection can be aborted by moving out of the widget before
releasing the mouse button.
.sp
\fBCancelSubtree()\fP: If in edit mode, moving out of the indicated widget
unhighlights the indicated subtree. However, moving back into the widget
without releasing the mouse button, re-highlights the indicated subtree.
Thus a selection can be aborted by moving out of the widget before
releasing the mouse button.
.sp
\fBMotion:\fP Moves a node or arc to a new position. 
.in -2
.sp 1
\fBEndButtonAction():\fP Handles all mouse button up events depending on a
state variable set by the button down action. Conceptually, this action can
be one of:
.in +2
.sp
\fBSelect:\fP If in edit mode and the mouse is on a node or arc widget The
node is persistantly highlighted and added to the list of selected widgets,
after unhighlighting any previously selected widgets and removing them from
the list. The XmNselectNodeCallback or XmNSelecttArcCallback are invoked.
.sp 1
\fBAddSelect:\fP If in edit mode and the mouse is on a node or arc widget,
the node is persistantly highlighted and added to the list of selected
widgets. Previously selected widgets remain selected.  The
XmNselectNodeCallback or XmNSelecttArcCallback are invoked, with the newly
selected widget indicated by the \fIwidget\fP member of the calldata, and
the entire set of selected widgets indicated by the selected_widgets and
selected_arcs members.
.sp 1
\fBSelectTree:\fP If in edit mode and the mouse is on a node, the subtree
whose root is that node is persistantly highlighted and added to the list of
selected widgets, after unhighlighting any previously selected widgets and
removing them from the list. The XmNselectNodeCallback or
XmNSelecttArcCallback are invoked.
.sp 1
\fBEndAddArcOrNode:\fP If a new node is being created, calls the
XmNnewNodeCallback list. If the value of the \fIdoit\fP member of the
calldata parameter is not FALSE when the callback returns, a new node is
created.  If a new arc is being created, the XmNnewArcCallback callback
list is invoked.  arc. If the value of the \fIdoit\fP member of the
calldata parameter is not FALSE when the callback returns, a new arc is
created.
.sp 1
\fBEndMotion\fP: Ends the movement of an arc or node.  Nodes are simply
moved physically, and the XmNnodeMovedCallback is invoked.  If the sprite
is not over a valid node when this procedure is called, the move is
aborted.  If an arc is moved, the XmNarcEditedCallback is invoked on the
arc, and the XmNarcMovedCallback is invoked on the graph widget, with the
arc as the \fIwidget\fP member.  The \fIold_to\fP and \fIold_from\fP
members of the calldata indicate the original nodes to which the arc was
connected, while the \fInew_to\fP and \fInew_from\fP indicate the nodes to
which the user has indicated the arc should be connected.  If the
\fIdoit\fP member of the calldata is not set to FALSE when either callback
returns, the arc is actually moved.
.in -2
.sp 2
.SH "EDIT MODE"
The translations discussed above are only valid while in edit mode, that is
when XmNeditable is TRUE. While not in edit mode, the graph widget acts as
a layout manager only, and passes all events on to its children without
interference.
.sp
.SH "UTILITY FUNCTIONS"
.sp
.sp
Widget \fBXmCreateGraph\fP \fI(parent, name, arglist, argcount)\fP
.br
  Widget    \fIparent;\fP
.br
  char      \fI*name;\fP
.br
  ArgList   \fIarglist;\fP
.br
  Cardinal  \fIargcount;\fP
.sp
.sp
\fBXmCreateGraph\fP creates an unmanaged instance of a Graph widget and
returns the associated widget ID.
.sp
Widget \fBXmCreateManagedGraph\fP \fI(parent, name, arglist, argcount)\fP
.br
  Widget    \fIparent;\fP
.br
  char      \fI*name;\fP
.br
  ArgList   \fIarglist;\fP
.br
  Cardinal  \fIargcount;\fP
.sp
.sp
\fBXmCreateManagedGraph\fP creates a managed instance of a Graph widget and
returns the associated widget ID.
.sp
Widget \fBXmCreateScrolledGraph\fP \fI(parent, name, arglist, argcount)\fP
.br
  Widget    \fIparent;\fP
.br
  char      \fI*name;\fP
.br
  ArgList   \fIarglist;\fP
.br
  Cardinal  \fIargcount;\fP
.sp
\fBXmCreateScrolledGraph\fP creates an instance of a Graph widget as a
child of an XmScrolledWindow widget and returns the widget ID of the Graph
widget. Notice that this function uses the AUTOMATIC scrollbar mode of the
XmScrolledWindow widget. This creates a ScrolledWindowClipWindow widget
which becomes the parent of the XmGraph widget. So the widget hierarchy of
an XmGraph widget named "graph" created with XmCreateScrolledGraph()
becomes "graphSW->ScrolledWindowClipWindow->graph". Programmers who do not
want these settings for the ScrolledWindow widget can create their own
instead of using the convenience function. However, the Graph widget does
extensive optimizations based on the existence of the ScrolledWindow's
clipWindow. Changing the way in which the ScrolledWindow is configured will
eliminate these optimizations.
.sp
\fBWidgetList XmGraphGetArcsBetweenNodes\fP \fI(graph, arcs, from, to)\fP
.br
    XmGraphWidget  \fIgraph;\fP
.br
    Widget          \fIfrom;\fP
.br
    Widget          \fIto;\fP
.sp
.sp
\fBXmGraphGetArcsBetweenNodes\fP returns a list of all XmArc widgets that
extend from \fIfrom\fP to \fIto\fP. If no such arc exists, returns NULL.
This list must be treated as read-only.
.sp
Boolean \fBXmGraphRemoveArcBetweenNodes\fP \fI(graph, widget1, widget2)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  Widget       \fIwidget1;\fP
.br
  Widget       \fIwidget2;\fP
.sp
\fBXmGraphRemoveArcBetweenNodes\fP destroys all arcs between \fIwidget1\fP, and
\fIwidget2\fP which must be node widgets in \fIgraph\fP.  Returns True if
successful, False otherwise.
.sp
Boolean \fBXmGraphMoveArc\fP \fI(graph, arc, from, to)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  ArcWidget       \fIarc;\fP
.br
  Widget         \fIfrom, to;\fP
.sp
\fBXmMoveArc\fP changes the end nodes of \fIarc\fP. Returns True if
successful, False otherwise.
.sp
void \fBXmGraphNumNodeArcs\fP \fI(graph, node, n_from, n_to)\fP
.br
  XmGraphWidget   \fIgraph;\fP
.br
  Widget           \fInode;\fP
.br
  int              \fI*n_from, *n_to;\fP
.sp
\fBXmGraphNumNodeArcs\fP assigns to \fIn_from\fP and \fIn_to\fP the number
of arcs associated with \fInode\fP. \fInode\fP must be a node widget in
\fIgraph\fP.
.sp
void \fBXmGraphGetNodeArcs\fP \fI(graph, node, from, to, n_from, n_to)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  Widget          \fInode;\fP
.br
  WidgetList       \fI*from, *to;\fP
.br
  int              \fI*n_from, *n_to;\fP
.sp
\fBXmGraphGetNodeArcs\fP will put in the \fIfrom\fP and \fIto\fP
WidgetLists the arcs associated with the given node widget. \fIfrom\fP and
\fIto\fP must be treated as read-only.  \fIn_from\fP and \fIn_to\fP return
the number of arcs. \fInode\fP must be a node widget in \fIgraph\fP.
.sp
void \fBXmGraphGetArcNodes\fP \fI(graph, arc, from, to)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  ArcWidget       \fIarc;\fP
.br
  Widget          \fI*from, *to;\fP
.sp
\fBXmGraphGetArcNodes\fP will store in the \fIfrom\fP and \fIto\fP widgets
the nodes associated with \fIarc\fP.
.sp
void \fBXmGraphSelectArcs\fP \fI(graph, arcs, n_arcs)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  WidgetList       \fIarcs;\fP
.br
  int              \fIn_arcs;\fP
.sp
\fBXmGraphSelectArcs\fP adds to the selected_arcs list of \fIgraph\fP the
first \fIn_arcs\fP in the WidgetList \fIarcs\fP.
.sp
void \fBXmGraphSelectArc\fP \fI(graph, arc)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  Widget       \fIarc;\fP
.sp
\fBXmGraphSelectArc\fP adds to the selected_arcs list of \fIgraph\fP the
given \fIarc\fP. \fIarc\fP must be a child of \fIgraph\fP.
.sp
void \fBXmGraphUnselectArcs\fP \fI(graph, arcs, n_arcs)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  WidgetList       \fIarcs;\fP
.br
  int              \fIn_arcs;\fP
.sp
\fBXmGraphUnselectArcs\fP removes from the selected_arcs list of
\fIgraph\fP the first \fIn_arcs\fP in the WidgetList \fIarcs\fP.
.sp
void \fBXmGraphUnselectArc\fP \fI(graph, arc)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  Widget      \fIarc;\fP
.sp
\fBXmGraphUnselectArc\fP removes \fIarc\fP from the selected_arcs list of
\fIgraph\fP. 
.sp
int \fBXmGraphNumSelectedArcs\fP \fI(graph)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.sp
\fBXmGraphNumSelectedArcs\fP returns the number of arcs in the
selected_arcs list of \fIgraph\fP.
.sp
WidgetList \fBXmGraphGetSelectedArcs\fP \fI(graph, arcs, n_arcs)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  int            *\fIn_arcs;\fP
.sp
\fBXmGraphGetSelectedArcs\fP will return a WidgetList \fIarcs\fP containing
all currently selected arcs. This list must be treated as read-only.
.sp
Boolean \fBXmGraphIsSelectedArc\fP \fI(graph, arc)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  Widget       \fIarc;\fP
.sp
\fBXmGraphIsSelectedArc\fP returns TRUE of the given \fIarc\fP is currently
selected.
.sp
int \fBXmGraphNumArcs\fP \fI(graph)\fP
.br
  XmGraphWidget   \fIgraph;\fP
.sp
\fBXmGraphNumArcs\fP returns the number of arc widgets in \fIgraph\fP.
.sp
WidgetList \fBXmGetGraphArcs\fP \fI(graph, arcs, num_arcs)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  int       *\fInum_arcs;\fP
.sp
\fBXmGraphGetArcs\fP will return a WidgetList containing all arc
widgets in \fIgraph\fP. This list must be treated as read-only.
.sp
WidgetList \fBXmGetGraphNodes\fP \fI(graph, arcs, num_nodes)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  int       *\fInum_nodes;\fP
.sp
\fBXmGetGraphNodes\fP will return a WidgetList containing all node
widgets in \fIgraph\fP. This list must be treated as read-only.
.sp
int \fBXmGraphNumSelectedNodes\fP \fI(graph)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.sp
\fBXmGraphNumSelectedNodes\fP returns the number of node widgets in the
selected_nodes list of \fIgraph\fP.
.sp
Boolean \fBXmGraphMoveNode\fP \fI(graph, node, x, y)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  Widget          \fInode;\fP
.br
  Position         \fIx, y;\fP
.sp
\fBXmGraphMoveNode\fP changes the position of \fInode\fP to \fIx\fP, and
\fIy\fP.  \fInode\fP must be a node widget in \fIgraph\fP.  Returns True if
successful, False otherwise.
.sp
void \fBXmGraphGetSelectedNodes\fP \fI(graph, nodes, n_nodes)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  WidgetList       \fInodes;\fP
.br
  int            *\fIn_nodes;\fP
.sp
\fBXmGraphGetSelectedNodes\fP will return a WidgetList containing all
node widgets in the selected_nodes list of \fIgraph\fP. 
.sp
Widget \fBXmGraphInputOverArc\fP \fI(graph, x, y)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  Position      \fIx, y;\fP
.sp
\fBXmGraphInputOverArc\fP  returns an XmArc widget which contains the point
(x, y). If no such arc exists, \fBXmGraphInputOverArc\fP returns NULL.
.sp
void \fBXmGraphSelectNodes\fP \fI(graph, nodes, n_nodes)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  WidgetList       \fInodes;\fP
.br
  int              \fIn_nodes;\fP
.sp
\fBXmGraphSelectNodes\fP adds to the selected_nodes list of \fIgraph\fP the
first \fIn_nodes\fP in the WidgetList \fInodes\fP.
.sp
void \fBXmGraphSelectNode\fP \fI(graph, node)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  Widget       \fInode;\fP
.sp
\fBXmGraphSelectNode\fP adds \fInode\fP to the selected_nodes list of
\fIgraph\fP.  \fInode\fP must be a child of \fIgraph\fP.
.sp
void \fBXmGraphDestroySelectedArcsOrNodes\fP \fI(graph)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.sp
\fBXmGraphDestroySelectedArcsOrNodes\fP calls XtDestroyWidget on all
selected arcs or nodes.
.sp
void \fBXmGraphDestroyAllArcs\fP \fI(graph)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.sp
\fBXmGraphDestroyAllArcs\fP calls XtDestroyWidget on all
arcs.
.sp
void \fBXmGraphDestroyAllNodes\fP \fI(graph)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.sp
\fBXmGraphDestroyAllNodes\fP calls XtDestroyWidget on all
node widgets.
.sp
void \fBXmGraphIsSelectedNode\fP \fI(graph, node)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  Widget      \fInode;\fP
.sp
\fBXmGraphIsSelectedNode\fP returns TRUE of the given \fInode\fP is currently
selected.
.sp
void \fBXmUnselectNodes\fP \fI(graph, nodes, n_nodes)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  WidgetList       \fInodes;\fP
.br
  int              \fIn_nodes;\fP
.sp
\fBXmGraphUnselectNodes\fP removes from the selected_nodes list of
\fIgraph\fP the first \fIn_nodes\fP in the WidgetList \fInodes\fP.
.sp
void \fBXmGraphUnselectNode\fP \fI(graph, node)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  Widget       \fInode;\fP
.sp
\fBXmGraphUnselectNode\fP removes node from the selected_nodes list of
\fIgraph\fP.
.sp
void \fBXmGraphNumNodes\fP \fI(graph)\fP
.br
  XmGraphWidget   \fIgraph;\fP
.sp
\fBXmGraphNumNodes\fP returns the number of node widgets in \fIgraph\fP,
not including the dummy node created by the graph.
.sp
void \fBXmGraphGetNodes\fP \fI(graph, nodes)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  WidgetList       \fInodes;\fP
.sp
\fBXmGraphGetNodes\fP will return a WidgetList containing all node
widgets in \fIgraph\fP. This list must be treated as read-only.
.sp
void \fBXmGraphRoots\fP \fI(graph, nodes, num_nodes)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  WidgetList       \fInodes;\fP
.br
  int          *\fInum_nodes;\fP
.sp
\fBXmGraphGetRoots\fP will insert into the WidgetList \fInodes\fP all node
widgets in the user_roots list of \fIgraph\fP. 
.sp
void \fBXmGraphInsertRoots\fP \fI(graph, nodes, n_nodes)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  WidgetList       \fInodes;\fP
.br
  int              \fIn_nodes;\fP
.sp
\fBXmGraphInsertRoots\fP adds to the user_roots list of \fIgraph\fP the first
\fIn_nodes\fP in the WidgetList \fInodes\fP. 
.sp
void \fBXmGraphRemoveRoots\fP \fI(graph, nodes, n_nodes)\fP
.br
  XmGraphWidget  \fIgraph;\fP
.br
  WidgetList       \fInodes;\fP
.br
  int              \fIn_nodes;\fP
.sp
\fBXmGraphRemoveRoots\fP removes from the user_roots list of \fIgraph\fP
the first \fIn_nodes\fP in the WidgetList \fInodes\fP. 
.sp
void \fBXmGraphNumRoots\fP \fI(graph)\fP
.br
  XmGraphWidget   \fIgraph;\fP
.sp
\fBXmGraphNumRoots\fP returns the number of node widgets in the user_roots list
of \fIgraph\fP.
.sp
void \fBXmGraphLayout\fP \fI(graph)\fP
.br
  XmGraphWidget   \fIgraph;\fP
.sp
\fBXmGraphLayout\fP forces a relayout of the entire graph. 
.sp
extern \fBXmGraphRelaySubgraph\fP \fI(graph, node)\fP
.br
  XmGraphWidget   \fIgraph;\fP
.br
  Widget          \fInode;\fP
.sp
\fBXmGraphRelaySubgraph\fP relays the subgraph rooted at the node widget
\fInode\fP.
.SH "BUGS"
This man page needs lots of work.
.sp
Performance begins to break down at around 2000 nodes if gadgets are used
as node, far less if widgets are used as nodes. The performance falls off
much more rapidly with a large number of arcs, particularly if the graph is
not "well-behaved".
.br
.SH ORIGIN
Hewlett-Packard Company.
.sp
.SH AUTHORS
Luis Miguel - Design and implementation of HP widget version of Graph widget
.br
Doug Young - Early prototype XwDAG and XwLink (now XmArc) widget and Motif
             port of Graph and Arc to XmGraph and XmArc
.br
Doug Young - nearly complete rewrite of Graph for Motif (1/90)
.SH "SEE ALSO"
Core(3X), Composite(3X), Constraint(3X), Manager(3X), XmArc(3x)
.br
\fIProgramming With The HP X Widgets\fP,
.br
\fIProgramming With Xt Intrinsics\fP,
.br
\fIProgramming With Xlib\fP.
